Skip to content

Conversation

@jaredcwhite
Copy link
Collaborator

@jaredcwhite jaredcwhite commented Dec 3, 2025

This PR addresses #5597, #5149, #5650, #5651

  • Addresses the issue in full
  • Addresses only certain aspects of the issue

Description

The PR adds a new, separate screen for viewing/editing Preferences (at the path /settings/preferences-new) which allows for managing MSQ V2 style preferences.

How Can This Be Tested/Reviewed?

To seed your local DB with preferences in V2, run: yarn setup --msqV2 in the api folder

Then you can log in as a Bloomington admin in Partners and access the new page via Settings. Otherwise you'll still see the old page and seed data.

It's possible to view the two seed preferences as well as add new preferences. Unfortunately there's no easy way to flip between Edit and View for the same preference. You could try manually editing the code in the preferences-new.tsx for the table. I'm also not sure how easy it is to test various other statuses available in the enum.

Some of the code for editing a preference is copied over and modified from the previous V1 editing, but all of the code for viewing is new, so it's possible I missed some edge cases or something in the UI could be improved. This is what I would call a "first draft".

There are also some follow-up issues which will touch on certain things in here, such as adding search, pagination, and sorting to the new preferences table.

Author Checklist:

  • Added QA notes to the issue with applicable URLs
  • Reviewed in a desktop view
  • Reviewed in a mobile view
  • Reviewed considering accessibility
  • Added tests covering the changes
  • Made corresponding changes to the documentation
  • Ran yarn generate:client and/or created a migration when required

Review Process:

  • Read and understand the issue
  • Ensure the author has added QA notes
  • Review the code itself from a style point of view
  • Pull the changes down locally and test that the acceptance criteria is met
  • Either (1) explicitly ask a clarifying question, (2) request changes, or (3) approve the PR, even if there are very small remaining changes, if you don't need to re-review after the updates

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for partners-bloom-dev ready!

Name Link
🔨 Latest commit 141c318
🔍 Latest deploy log https://app.netlify.com/projects/partners-bloom-dev/deploys/6930cb5b672efb0008fb2d74
😎 Deploy Preview https://deploy-preview-5654--partners-bloom-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for bloom-flagly ready!

Name Link
🔨 Latest commit 141c318
🔍 Latest deploy log https://app.netlify.com/projects/bloom-flagly/deploys/6930cb5b51e25c0008ff1894
😎 Deploy Preview https://deploy-preview-5654--bloom-flagly.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for bloom-public-seeds ready!

Name Link
🔨 Latest commit 141c318
🔍 Latest deploy log https://app.netlify.com/projects/bloom-public-seeds/deploys/6930cb5ba7043b0008662396
😎 Deploy Preview https://deploy-preview-5654--bloom-public-seeds.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for bloom-exygy-dev ready!

Name Link
🔨 Latest commit 141c318
🔍 Latest deploy log https://app.netlify.com/projects/bloom-exygy-dev/deploys/6930cb5b86cb6400080918d7
😎 Deploy Preview https://deploy-preview-5654--bloom-exygy-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for bloom-angelopolis ready!

Name Link
🔨 Latest commit 141c318
🔍 Latest deploy log https://app.netlify.com/projects/bloom-angelopolis/deploys/6930cb5b4d280f0008dd5caa
😎 Deploy Preview https://deploy-preview-5654--bloom-angelopolis.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for bloom-lakeview ready!

Name Link
🔨 Latest commit 141c318
🔍 Latest deploy log https://app.netlify.com/projects/bloom-lakeview/deploys/6930cb5b38401e000849c6d7
😎 Deploy Preview https://deploy-preview-5654--bloom-lakeview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for partners-bloom-dev ready!

Name Link
🔨 Latest commit b68ea77
🔍 Latest deploy log https://app.netlify.com/projects/partners-bloom-dev/deploys/6967e822b1dcb900082a771e
😎 Deploy Preview https://deploy-preview-5654--partners-bloom-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for bloom-public-seeds ready!

Name Link
🔨 Latest commit b68ea77
🔍 Latest deploy log https://app.netlify.com/projects/bloom-public-seeds/deploys/6967e8223b23580008ffb186
😎 Deploy Preview https://deploy-preview-5654--bloom-public-seeds.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for bloom-exygy-dev ready!

Name Link
🔨 Latest commit b68ea77
🔍 Latest deploy log https://app.netlify.com/projects/bloom-exygy-dev/deploys/6967e82178964b00086218ef
😎 Deploy Preview https://deploy-preview-5654--bloom-exygy-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for bloom-angelopolis canceled.

Name Link
🔨 Latest commit b68ea77
🔍 Latest deploy log https://app.netlify.com/projects/bloom-angelopolis/deploys/6967e8225f208b000729b8de

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for bloom-flagly ready!

Name Link
🔨 Latest commit b68ea77
🔍 Latest deploy log https://app.netlify.com/projects/bloom-flagly/deploys/6967e8228c0a1c000959c6e8
😎 Deploy Preview https://deploy-preview-5654--bloom-flagly.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for bloom-lakeview ready!

Name Link
🔨 Latest commit b68ea77
🔍 Latest deploy log https://app.netlify.com/projects/bloom-lakeview/deploys/6967e822ce311a0008b4f7c9
😎 Deploy Preview https://deploy-preview-5654--bloom-lakeview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jaredcwhite
Copy link
Collaborator Author

I don't understand why the Backend Integration test keeps failing. When I run it locally, I do get one failure…but it's a totally different failure in some other file. 😅

@jaredcwhite jaredcwhite marked this pull request as ready for review January 14, 2026 01:18
@jaredcwhite jaredcwhite changed the title 5597/new preferences table feat: set up new Preferences page & edit/view drawers (MSQ V2) Jan 14, 2026
@jaredcwhite jaredcwhite added the 2 reviews needed Requires 2 more review before ready to merge label Jan 14, 2026
@ludtkemorgan
Copy link
Collaborator

@jaredcwhite the failing property backend test appears to be because of an edge case depending on the order that the tests run. The test in question is not passing any parameters so it's defaulting to 10 as the page size, however some other tests add properties so sometimes there are more than 10 properties meaning one or both of the properties we are looking for might be on the second page. We will have to make the test more generic. I can quickly put up a PR to take that into account.

Copy link
Collaborator

@ludtkemorgan ludtkemorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far looking pretty good functionally. I'm still making my way through the changes but wanted to get my review out for what I have reviewed so far.

Can you also add new frontend tests for this new functionality? We should have a new test suite for the new edit page along with all of the drawers/modals. Let me know if you need any assistance with coming up with test cases for those

type="text"
dataTestId={"preference-title"}
defaultValue={questionData?.name}
errorMessage={`${t("errors.requiredFieldError")}. ${t(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is showing up even when I have a valid value here but there is an issue somewhere else on the form.

Image

So for example I filled out the title but didn't add any options and clicked "save". The error for this field appeared along with the "add option" button being red. Only the "add option" error should have appeared

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about the regex I added for this…it requires an uppercase first letter but maybe I need to relax that. I think that's why you were running into an error here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also noticed the regex doesn't allow parenthesis but when you copy a preference it defaults to adding (copy) to the preference name. I wonder how we should handle that.

This is the current flow:

  1. click "edit" or "view" on any preference
  2. Click "copy"
  3. open the new preference and click "save" or "show to partners"
  4. The name field shows an error
Image

@@ -0,0 +1,152 @@
import React, { useContext, useState } from "react"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm worried having the name preferences-new as the folder name is going to be here for a long time if we never get around to cleaning up the feature flag. Could you rename the folder something like preferences-v2 to follow the pattern we have been using for the MSQ refactor?

@@ -0,0 +1,201 @@
import React, { useContext, useState, useMemo } from "react"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same as other comment about calling this preferences-v2.tsx to follow the naming pattern we have been using for the feature flag

readerOnly
dataTestId={"preference-option-title"}
defaultValue={optionData?.name}
errorMessage={`${t("errors.requiredFieldError")}. ${t(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here in the options drawer with the error message showing when there is a valid value but an error somewhere else on the page

Image

async function main() {
const {
values: { environment, jurisdictionName },
values: { environment, jurisdictionName, msqV2 },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

onError?: (err: any) => void
}

export const useMutate = <UseMutateResponse>() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: with this file here can we switch the usage of the ui-component version over to this version? Looks like the ui-component useMutate is used in a handful of files

type="text"
dataTestId={"preference-title"}
defaultValue={questionData?.name}
errorMessage={`${t("errors.requiredFieldError")}. ${t(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also noticed the regex doesn't allow parenthesis but when you copy a preference it defaults to adding (copy) to the preference name. I wonder how we should handle that.

This is the current flow:

  1. click "edit" or "view" on any preference
  2. Click "copy"
  3. open the new preference and click "save" or "show to partners"
  4. The name field shows an error
Image

</Button>
<Button type="button" variant="primary-outlined" onClick={toggleVisibility}>
{!questionData || questionData?.status === MultiselectQuestionsStatusEnum.draft
? "Show to Partners"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can these strings be added to the partners general.json file?

<Button
type="button"
variant="primary"
onClick={async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: could this onClick function declaration get pulled out of being within the <button>?

view: {
content: (
<Button variant="text" onClick={() => setOptionData(item)}>
View
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same here for getting it from the general.json file

{
name: 'At least one member of my household is a city employee',
collectAddress: false,
ordinal: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the default ordinal should be 1 and not 0. Otherwise these seeded preferences show as ordinal 0

Image

profile?.jurisdictions.every((juris) => juris.enableGeocodingRadiusMethod)
const radiusExpand =
(optionData?.validationMethod === ValidationMethodEnum.radius &&
watch("validationMethod") === undefined) ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: looks like you are doing watch("validationMethod") 4 times here. Could it be a variable created above all of these?

@jaredcwhite
Copy link
Collaborator Author

@ludtkemorgan Regarding tests, I'm thinking of adapting the unit/component-level tests to the new pages, and leaving Cypress alone for now. I feel like maintaining e2e tests for two different DB schemas would be really complicated, so maybe we can revisit if/how to do it once we sunset V1.

@ludtkemorgan
Copy link
Collaborator

@ludtkemorgan Regarding tests, I'm thinking of adapting the unit/component-level tests to the new pages, and leaving Cypress alone for now. I feel like maintaining e2e tests for two different DB schemas would be really complicated, so maybe we can revisit if/how to do it once we sunset V1.

That sounds great! Yeah, I don't think we need cypress tests at this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 reviews needed Requires 2 more review before ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants